<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AWTK-JAVA: awtk.TRlog类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">AWTK-JAVA
   </div>
   <div id="projectbrief">AWTK JAVA API</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>awtk</b></li><li class="navelem"><a class="el" href="classawtk_1_1_t_rlog.html">TRlog</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="classawtk_1_1_t_rlog-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">awtk.TRlog类 参考</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a26b49c2c143e98e503ab3a191fd20c4e" id="r_a26b49c2c143e98e503ab3a191fd20c4e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a26b49c2c143e98e503ab3a191fd20c4e">TRlog</a> (long <a class="el" href="#a17f1d79e84ae84c6a92a78e62c4341d0">nativeObj</a>)</td></tr>
<tr class="separator:a26b49c2c143e98e503ab3a191fd20c4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2209a02b6f484b777b3cdfc261304c1" id="r_ac2209a02b6f484b777b3cdfc261304c1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_t_ret.html">TRet</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac2209a02b6f484b777b3cdfc261304c1">write</a> (String str)</td></tr>
<tr class="separator:ac2209a02b6f484b777b3cdfc261304c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:a5e86b4c3730c6a694c984b16a59092f1" id="r_a5e86b4c3730c6a694c984b16a59092f1"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classawtk_1_1_t_rlog.html">TRlog</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5e86b4c3730c6a694c984b16a59092f1">cast</a> (long <a class="el" href="#a17f1d79e84ae84c6a92a78e62c4341d0">nativeObj</a>)</td></tr>
<tr class="separator:a5e86b4c3730c6a694c984b16a59092f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad0aa3c02a78650c97e5005d75698e817" id="r_ad0aa3c02a78650c97e5005d75698e817"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classawtk_1_1_t_rlog.html">TRlog</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad0aa3c02a78650c97e5005d75698e817">create</a> (String filename_pattern, int max_size, int buff_size)</td></tr>
<tr class="separator:ad0aa3c02a78650c97e5005d75698e817"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:a17f1d79e84ae84c6a92a78e62c4341d0" id="r_a17f1d79e84ae84c6a92a78e62c4341d0"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a17f1d79e84ae84c6a92a78e62c4341d0">nativeObj</a></td></tr>
<tr class="separator:a17f1d79e84ae84c6a92a78e62c4341d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>循环记录日志(支持多线程访问)。 如果我们把日志写入文件中，随着时间的推移，日志文件会越来越大，最终占满这个磁盘，出现不可预料的错误。 rlog提供一个循环记录日志的功能，让日志文件始终不会超出指定的大小，达到指定大小后再从头开始写。</p>
<blockquote class="doxtable">
<p>为了实现简单，我们把日志文件分成0和1两个文件，先写文件0，到达指定最大值的一半时，再写文件1。 文件1到达指定最大值的一半时，删除文件0，并将文件1改名为文件0，重新创建文件1，继续写文件1，重复此过程。 </p>
</blockquote>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a26b49c2c143e98e503ab3a191fd20c4e" name="a26b49c2c143e98e503ab3a191fd20c4e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a26b49c2c143e98e503ab3a191fd20c4e">&#9670;&#160;</a></span>TRlog()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">awtk.TRlog.TRlog </td>
          <td>(</td>
          <td class="paramtype">long</td>          <td class="paramname"><span class="paramname"><em>nativeObj</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>通过nativeObj构造Java对象。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">nativeObj</td><td>原生对象。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>对应的Java对象。 </dd></dl>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a5e86b4c3730c6a694c984b16a59092f1" name="a5e86b4c3730c6a694c984b16a59092f1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e86b4c3730c6a694c984b16a59092f1">&#9670;&#160;</a></span>cast()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classawtk_1_1_t_rlog.html">TRlog</a> awtk.TRlog.cast </td>
          <td>(</td>
          <td class="paramtype">long</td>          <td class="paramname"><span class="paramname"><em>nativeObj</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>把nativeObj转换层Java对象。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">nativeObj</td><td>原生对象。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>对应的Java对象。 </dd></dl>

</div>
</div>
<a id="ad0aa3c02a78650c97e5005d75698e817" name="ad0aa3c02a78650c97e5005d75698e817"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad0aa3c02a78650c97e5005d75698e817">&#9670;&#160;</a></span>create()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classawtk_1_1_t_rlog.html">TRlog</a> awtk.TRlog.create </td>
          <td>(</td>
          <td class="paramtype">String</td>          <td class="paramname"><span class="paramname"><em>filename_pattern</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>max_size</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>buff_size</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>创建rlog对象。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">filename_pattern</td><td>用来确定文件名的路径和文件名。 </td></tr>
    <tr><td class="paramname">max_size</td><td>log文件占用最大磁盘空间(字节)。 </td></tr>
    <tr><td class="paramname">buff_size</td><td>用于指定print时的buff大小。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回rlog对象。 </dd></dl>

</div>
</div>
<a id="ac2209a02b6f484b777b3cdfc261304c1" name="ac2209a02b6f484b777b3cdfc261304c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2209a02b6f484b777b3cdfc261304c1">&#9670;&#160;</a></span>write()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_t_ret.html">TRet</a> awtk.TRlog.write </td>
          <td>(</td>
          <td class="paramtype">String</td>          <td class="paramname"><span class="paramname"><em>str</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>写入一条日志记录。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>日志字符串。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a id="a17f1d79e84ae84c6a92a78e62c4341d0" name="a17f1d79e84ae84c6a92a78e62c4341d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a17f1d79e84ae84c6a92a78e62c4341d0">&#9670;&#160;</a></span>nativeObj</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long awtk.TRlog.nativeObj</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>原生对象。 </p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>output/<b>TRlog.java</b></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2
</small></address>
</div><!-- doc-content -->
</body>
</html>
